<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

final class News extends BIT_Model
{
	public static $class_name = __CLASS__;
	
	protected $id;
	
	protected $datum;
	
	protected $headline;
	
	protected $content;
	
	private $db = "";
	
	function __construct(){
		parent::__construct();
	}
	
	public static function getLatestNews($limit = 5){
		$db = get_instance()->db;
		return $db->order_by('datum' ,'desc')->limit($limit)->get('news')->result();
	}
	
	public function saveCompany($data){
		
		if(!$data){
			return false;
		}

		foreach($data as $key => $value){
			$this->$key = $value;
		}
		
		$this->save();
		
		return true;
	}
}